<?php
namespace app\common\model;
use x\Xbase;
class Tie extends Xbase
{
    /**
     * 删除回复
     * @param  [type] $id [description]
     * @return [type]     [description]
     */
    public function del($id){
        $ids = is_array($id) ? $id : [$id];
        foreach($ids as $id){
            //删除回复和点赞
            $reply = $this->db->query('select id from reply where tie_id=?',[$id]);
            foreach($reply as $v){
                m('reply','c')->del($v['id']);
            }
            //删除帖子
            $this->db->delete('tie',$id);
            m('Attachment','xcom')->imgDel('tie',$id,true);
        }
        return true;
    }
}
